//
//  IslanShowMoreCommentCtrl.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/4/9.
//  Copyright © 2016年 game. All rights reserved.
//

#import "IslanShowMoreCommentCtrl.h"

#import "DianpingCell.h"
#import "LoginController.h"
#import "OtherInformationCtrl.h"

@interface IslanShowMoreCommentCtrl ()<UITableViewDataSource,UITableViewDelegate,DianpingCellDeleget>

@property (nonatomic,assign) CGFloat cellHeight;
@property (nonatomic,strong) UITableView *tableview;
@end

@implementation IslanShowMoreCommentCtrl

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.app.myTabBar.tabBar.hidden = YES;
    self.navigationController.navigationBarHidden = YES;

}
- (IBAction)backAction:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStylePlain];
    [self.tableview registerNib:[UINib nibWithNibName:@"DianpingCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    self.tableview.separatorStyle = 0;
    [self.view addSubview:self.tableview];
}

-(void)setDataAry:(NSArray *)dataAry{
    _dataAry = dataAry;
    
    [self.tableview reloadData];

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.dataAry.count;
}

-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return self.cellHeight;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{


    DianpingCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    cell.model = self.dataAry[indexPath.row];
    
    self.cellHeight = cell.CellHight;
    cell.cellRow = indexPath.row;
    cell.deleget = self;
    return cell;
}


-(void)PramisClickWhithRow:(NSInteger)row AndIslogin:(BOOL)islogin{

    if (islogin) {
        IslandCommentModel *model = self.dataAry[row];
        model.iszan = YES;
    }else{
        LoginController *login = [LoginController new];
        [self.navigationController pushViewController:login animated:YES];
    
    }
}
-(void)personSpaceClickWhithPersonId:(NSString *)personId{
    OtherInformationCtrl *space=  [OtherInformationCtrl new];
    
    space.uid = personId;
    [self.navigationController pushViewController:space animated:YES];
}

@end
